package be.ac.ua.customer.gui;

import javax.xml.ws.Service;
import javax.xml.ws.WebServiceRef;

import com.textdisguise.textdisguise.captchaservice.CaptchaImageWordModel;
import com.textdisguise.textdisguise.captchaservice.CaptchaService;
import com.textdisguise.textdisguise.captchaservice.ClientAuthModel;

public class Captcha {

	CaptchaService fCaptchaService = new CaptchaService();
	ClientAuthModel fClientAuth = new ClientAuthModel();
	CaptchaImageWordModel fWord;
	
	public Captcha() {
		fClientAuth.setGuid("5cd2013c-6e30-419d-92c8-043c8763b0b0");
		fClientAuth.setPassword("mPY7vu#WC=:.;W\"l2z[`>#oJFl");
		
		fWord = fCaptchaService.getCaptchaServiceSoap().getNewWord(fClientAuth);
		System.out.println("id " + fWord.getCaptchaImageGuid() + " url " + fWord.getUrl());
	}
	
	public String getImageUrl() {
		return fWord.getUrl();
	}
	
	public boolean getResult(String string) {
		return fCaptchaService.getCaptchaServiceSoap().validateImageWord(fClientAuth, fWord.getCaptchaImageGuid(), string);
	}
}
